package com.zhuss.core.wrongWord;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.zhuss.bean.bo.core.wrongWord.CreateWrongWordBo;
import com.zhuss.bean.bo.core.wrongWord.DeleteWrongWordBo;
import com.zhuss.bean.bo.core.wrongWord.UpdateWrongWordBo;
import com.zhuss.common.OperateService;
import com.zhuss.common.Processor;
import com.zhuss.exception.WpsException;

/**
 * @description: 敏感字操作的Service
 * @author: zhushanshuo
 * @create: Fri Nov 20 13:10:22 CST 2020
 **/
@Component("wrongWordOperateService")
public class WrongWordOperateService implements OperateService<Void, Object> {
	
	@Autowired
	@Qualifier("wrongWordCreate")
	private Processor<Object, CreateWrongWordBo> wrongWordCreate;
	
	@Autowired
	@Qualifier("wrongWordUpdate")
	private Processor<Object, UpdateWrongWordBo> wrongWordUpdate;
	
	@Autowired
	@Qualifier("wrongWordDelete")
	private Processor<Object, DeleteWrongWordBo> wrongWordDelete;
	
	
	/**
	 * 创建
	 */
	@Override
    @Transactional(rollbackFor = Exception.class)
	public Void create(Object param) throws WpsException {
		
		CreateWrongWordBo bo = (CreateWrongWordBo) param;
		
		wrongWordCreate.process(bo);
		
		return null;
	}
    
	/**
	 * 修改
	 */
	@Override
    @Transactional(rollbackFor = Exception.class)
    public Void update(Object param) throws WpsException {
    	
		UpdateWrongWordBo bo = (UpdateWrongWordBo) param;
		
		wrongWordUpdate.process(bo);
		
    	return null;
    }
	
	/**
	 * 删除
	 */
	@Override
	@Transactional(rollbackFor = Exception.class)
	public Void delete(Object param) throws WpsException {
		
		DeleteWrongWordBo bo = (DeleteWrongWordBo) param;
		
		wrongWordDelete.process(bo);
		
		return null;
	}
	
}

